home *** CD-ROM | disk | FTP | other *** search
- /*==================================================================
- File: MacZString.h
-
- Contains: Mac-specific parsing for ZStrings.
-
- Written by: Eric Traut
-
- Copyright: 2000-2001 Connectix Corporation
-
- This source has been placed into the public domain by
- Connectix Corporation. You have the right to modify,
- distribute or use this code without any legal limitations
- or finanicial/licensing requirements. Connectix is not
- liable for any problems that result from the use of this
- code.
-
- If you have comments, feedback, questions, or would like
- to submit bug fixes or updates to this code, please email
- opensource@connectix.com.
- ==================================================================*/
-
- #ifndef __MACZSTRING__
- #define __MACZSTRING__
-
-
- #include "ZString.h"
- #include "ZStringParser.h"
-
- #include <Resources.h>
- #include <Menus.h>
-
- enum
- {
- kZStringOverrideDictionaryResType = 'ZOvr',
- kZStringTwoByteTableResType = 'ZTBt',
-
- // To override the default behavior (i.e.
- // choosing the language based on the system
- // software), put a two-byte ID inside the
- // following resource.
- kZStringLanguageSpecifierResType = 'ZLan',
- kZStringLanguageSpecifierID = 128
-
- };
-
-
- /*==================================================================
- ZString
- ==================================================================*/
-
- class MacZString : public ZString
- {
- public:
- // Initialization & Teardown
- static void
- Initialize();
-
- static void
- TearDown();
-
- static void
- GetNamedPString(
- const char * inNamedString,
- StringPtr outPString,
- Z_UInt32 inMaxLength = 255,
- Z_Boolean inDataIsVolatile = false);
-
- static void
- GetNamedPString(
- ConstStringPtr inNamedString,
- StringPtr outPString,
- Z_UInt32 inMaxLength = 255,
- Z_Boolean inDataIsVolatile = false);
-
- static UInt8
- ExtractMenuInfo(
- const char * inMenuZString,
- Str255 outMenuItemText);
-
- static void
- BuildMenu(
- MenuHandle inMenuHandle,
- const char ** inMenuInfo,
- Boolean inInsertMenu = true);
-
- static void
- LoadOverrideDictionary(
- ResID inOverrideID);
-
- static ResID
- CalculateFontInfoBaseID(
- ResID inOverrideID);
-
- static ResID
- CalcOverrideDictionaryID();
-
- // Replacing Substrings
- ZString
- ReplaceParameter(
- Z_UInt8 inParamNum,
- const char * inString)
- { return ZString::ReplaceParameter(inParamNum, inString); }
-
- ZString
- ReplaceParameter(
- Z_UInt8 inParamNum,
- Z_SInt32 inNumber)
- { return ZString::ReplaceParameter(inParamNum, inNumber); }
-
- ZString
- ReplaceParameter(
- Z_UInt8 inParamNum,
- ConstStringPtr inString);
-
- public:
- static Handle sOverrideHandle;
- };
-
-
- /*==================================================================
- MacZStringParser
- ==================================================================*/
-
- class MacZStringParser : public ZStringParser
- {
- public:
- virtual UInt16
- GetTagReplacement(
- ZStringTagID inTagID,
- char * outReplacement);
- };
-
-
- /*==================================================================
- MacZStringInitializer
-
- This class is suitable for use as a stack-based initializer when
- using ZString in standalone code modules that are loaded and
- unloaded between calls.
- ==================================================================*/
-
- class MacZStringInitializer
- {
- public:
- MacZStringInitializer()
- {
- MacZString::Initialize();
- MacZString::LoadOverrideDictionary(MacZString::CalcOverrideDictionaryID());
- }
-
- ~MacZStringInitializer()
- {
- MacZString::TearDown();
- }
- };
-
- #endif // __MACZSTRING__
-
-
-